
#ifndef VRN_ZCOMPOSITOR_H
#define VRN_ZCOMPOSITOR_H

#include "voreen/core/processors/processor.h"
#include "voreen/core/processors/imageprocessor.h"

#include "voreen/core/properties/optionproperty.h"
#include "voreen/core/properties/floatproperty.h"
#include "voreen/core/properties/boolproperty.h"

#include "voreen/core/ports/renderport.h"
#include "tgt/shadermanager.h"

namespace voreen {

/// Composites the the images at the two inports using the selected blending method.
class ZCompositor : public ImageProcessor {
public:
    ZCompositor();
    ~ZCompositor();

    virtual std::string getCategory() const { return "Image Processing"; }
    virtual std::string getClassName() const { return "ZCompositor"; }
    virtual Processor::CodeState getCodeState() const { return CODE_STATE_STABLE; }
    virtual Processor* create() const {return new ZCompositor();}

    virtual bool isReady() const;

protected:
    virtual void setDescriptions() { setDescription("Composites two images with a selectable blending method."); }

    void process();
    virtual std::string generateHeader(const tgt::GpuCapabilities::GlVersion* version = 0);
    virtual void compile();

    void compositingModeChanged();

    virtual void initialize() throw (tgt::Exception);
    virtual void deinitialize() throw (tgt::Exception);

    RenderPort inport0_;
    RenderPort inport1_;
    RenderPort outport_;

    tgt::Shader* copyShader_;

private:
    StringOptionProperty compositingModeProp_;
    IntProperty kernelSizeProp_;


    IntProperty patternWidthProp_;
    IntProperty offsetX_;
    IntProperty offsetY_;
    FloatProperty overlayThreshold_;
};


} // namespace voreen

#endif //VRN_ZCOMPOSITOR_H
